const Koa = require('koa')
const router = require('koa-router')()
const static = require('koa-static')


const app = new Koa()

router.get('/', ctx => {
    ctx.body = '<h1>首页</h1>'
})

router.get('/doc', ctx => {
    ctx.body = `
        <h2>标题</h2>
        <p>内容</p>
        <img src="/images/logo.png" style="width: 280px">
    `
})
// app.use(async (ctx) => {
//     ctx.body = 'hello world'
// })
app.use(router.routes())
app.use(static(__dirname + '/public'))

app.listen('3000', () => {
    console.log('hello')
})